import 'package:bloc/bloc.dart';
part 'login_event.dart';
part 'login_state.dart';

class LoginBloc extends Bloc<LoginEvent, LoginState> {
  LoginBloc() : super(LoginState().init()) {
    on<CommitCodeEvent>(_commitCodeEvent);
    on<CommitPhoneEvent>(_commitPhoneEvent);
  }

  void _commitPhoneEvent(event, emit) {
    state.phoneNumber = event.phoneNumber;
    emit(state.clone());
  }

  void _commitCodeEvent(event, emit) {
    state.codeNumber = event.codeNumber;
    emit(state.clone());
  }
}
